package com.threez.core.exception.enums;

import lombok.AllArgsConstructor;

/**
 * @author zhaozz
 * @title GlobalExceptionEnum
 * @date 2023/1/14 10:58
 */
@AllArgsConstructor
public enum GlobalExceptionEnum implements BaseExceptionEnums {
    GLOBAL_ERROR("00001", "操作失败"),
    SYS_ERROR("00002", "{}"), //自定义异常描述
    SQL_PARAM_ERROR("00003", "参数不符合规范，不能进行查询"),
    LOGIN_USER_ERROR("00004", "用户登录异常"),
    REPEAT_REQ_ERROR("00005", "重复提交间隔时间不能小于'1'秒"),
    MYBATIS_PLUS_ERROR("00006", "mybatis自定义异常处理"),
    MY_PERMISSIONS_ERROR("00007", "数据权限解析异常，{}"),
    MY_ROLE_ERROR("00008", "角色数据范围异常，key与value长度不匹配"),
    FORBIDDEN("00009", "没有访问权限，请联系管理员授权"),
    UNAUTHORIZED("00010", "认证失败，{}"),
    UNAUTHORIZED_INTERFACE("00011", "认证失败，无法访问系统资源"),
    PARAM_ERROR("00011", "参数校验异常，{}"),
    PARAM_TRANS_ERROR("00012", "类型转换异常"),
    SERVICE_FACADE_ERROR("00013", "服务调用异常"),
    SQL_INJECTION_ERROR("00014", "参数存在SQL注入风险"),
    SORT_PARAM_ERROR("00015", "排序参数有误"),
    DATA_SCOPE_TYPE_ERROR("00016", "角色数据范围异常"),
    REPEAT_DATA_ERROR("00017", "数据库中已存在该记录，请联系管理员确认"),
    DATA_SOURCE_ERROR("00018", "未找到数据源，请联系管理员确认"),


    /**
     * ================
     */
    HTTP_CONFIG_CONNECT_TIMEOUT("00980", "连接超时时间必须大于0"),
    HTTP_CONFIG_READ_TIMEOUT("00981", "读超时时间必须大于0"),
    HTTP_CONFIG_WRITE_TIMEOUT("00982", "写超时时间必须大于0"),
    HTTP_CONFIG_TIMEUNIT("00983", "TimeUnit不能为空"),
    HTTP_CONFIG_OTHER("00984", "{}"),
    HTTP_CONFIG_FILE_NAME("00985", "文件名不能为空"),
    HTTP_CONFIG_FILE_CONTENT("00986", "文件内容不能为空"),
    HTTP_CONFIG_FILE_NOT_EXIST("00987", "文件不存在"),
    HTTP_CONFIG_RESPONSE_BODY_ERROR("00988", "响应体解析失败"),
    ;
    private String code;
    private String msg;

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String getModuleName() {
        return "global";
    }
}
